/**
* \file DGVConsole.h
*
* \brief This file defines the class for displaying messages in a DGVMain or DGVMainVTK classes as a docked widget using only Qt.
* \author Shekhar S. Chandra, 2008
*
* This file is part of DGV Library.
*
* DGV is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DGV is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DGV.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DGVCONSOLE_H
#define DGVCONSOLE_H

#include <QApplication>
#include <QDockWidget>
#include <QListWidget>

#include "DGVAliases.h"

/*!
    \class DGVConsole
    \brief This class represents a dockable console for DGVMainVTK class.
    \author Shekhar S. Chandra, 2008

    Console display and handling class that controls DGV error, info and warning outputs.
    It allows the output of various levels of messages using colours on a QListWidget.
*/
class DGV_EXPORT DGVConsole : public QDockWidget
{
    Q_OBJECT

public:
    /**
    \fn DGVConsole::DGVConsole(QWidget *parent = 0)
    \brief Standard constructor
    */
    DGVConsole(QWidget *parent = 0);
    /**
    \fn DGVConsole::~DGVConsole
    \brief Standard destrutor
    */
    virtual ~DGVConsole();

    /**
    \fn DGVConsole::printError(QString error)
    \brief Outputs the error message in the console in red.
    */
    void printError(QString error);
    /**
    \fn DGVConsole::printWarning(QString warning)
    \brief Outputs the warning message in the console in blue.
    */
    void printWarning(QString warning);
    /**
    \fn DGVConsole::printInfo(QString info)
    \brief Outputs the info message in the console in black.
    */
    void printInfo(QString info);
    /**
    \fn DGVConsole::printMessage(QString msg)
    \brief Outputs the message in the console in green.
    */
    void printMessage(QString msg);

public slots:
    /**
    \fn DGVConsole::toFinalEntry()
    \brief Selects the final entry.
    */
    inline void toFinalEntry()
    {   listDisplay->setCurrentRow(listDisplay->count()-1); }

signals:
    /**
    \fn DGVConsole::consoleChanged()
    \brief Signal used when messages are printed in console.
    */
    void consoleChanged();

protected:
    QListWidget *listDisplay; //!< Output widget

    /**
    \fn DGVConsole::createConnections()
    \brief Creates the internal connections for the console.
    */
    void createConnections();
};

#endif // DGVCONSOLE_H
